package other.nowcoder.easy;

import java.util.Scanner;

/**
 * @author bruin_du
 * @description 汽水瓶
 * https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f?
 * tpId=37&&tqId=21245&rp=1&ru=/activity/oj&qru=/ta/huawei/question-ranking
 * @date 2022/5/16 20:13
 **/
public class SodaBottles {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int num = in.nextInt();
            if(num == 0)
                break;
            int left = 0;
            int drink = 0;
            while(true){
                int tmp = num / 3;
                drink += tmp;
                left = tmp + num % 3;
                num = left;
                if(left <= 3){
                    if(left >= 2)
                        drink += 1;
                    break;
                }
            }
            System.out.println(drink);
        }
    }
}
